1. Field of the Invention
The present invention relates to a program analyzer for analyzing a source program written in a C-language, and more particularly, the present invention relates to a program analyzer which can specify a start position of a function having a function name designated by a programmer in the source program at high speed and high precision.
2. Description of the Related Art
When describing a source program by using a programming language, compiling the source program to a machine language by using a compiler and executing the machine language, as a result of execution, an unexpected result happens to occur due to programming failures, or an abnormal completion is found during execution. When these failures occur, it is necessary to investigate conditions in which such failure occurs, and to trace out the position in which such programming failure occurs.
For example, a method using a support program which is called debugger is widely used as one method. According to this method, when using the support program, since it is possible to find the function name of the function (sub-routine) which is finally executed in the program based on a state of a register and a main storage in a CPU at abnormal completion, it is possible to effectively execute the above investigation and trace.
In addition to the support program, if there is provided an interactive program which supports a review of the description of the function having a designated function name, it is expected that working efficiency is improved. The interactive program requires a time shortened from designation of the function name until start of analysis. To realize shortened time, it is required to quickly obtain the start position of the function from the designated function name.
Although the program by the C-language has sets of a declaration and a function definition, there are no special symbol and character sequence for indicating identification of the declaration and the function definition and designating the start and end of both declaration and function definition. From this reason, to obtain the start position of the designated function, it is necessary to sequentially define the end position of both declaration and function definition from a head of the program. As one method for defining the end position, there is a method for sequentially analyzing the start position from the head of the program according to a grammatical rule. That is, as well as a syntax analysis at the compiler, this is a method for defining the end position of the declaration and the function definition one by one by producing a parse tree and applying a production rule of the C-language in detail to the program.
As another method, there is a method for utilizing a started character position in a line of each function, which is output to an object program as a symbol information, when the compiler performs translation process.
However, according to the former art, since this is a method for defining the end position of the declaration and the function definition one by one by sequentially analyzing the end position from the head of the program based on the syntax rule and applying the production rule of the C-language in detail to the program, there is a problem in which a lot of time is required until the target function is obtained.
Further, according to the latter art, although it is possible to realize a high speed processing compared with the former art, the started character position in a line is not indicated in the strict sense of the word. Accordingly, there is a problem in which, for example, the latter happens to indicate the character position in which the function name exists. Further, there is a problem in which it is impossible to indicate the start position of the function using the character position in a line. This is because, in the C-language, it is logically possible to describe a plurality of functions in one character position in a line.